package uk.ac.cam.echo.app;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class EventSpecificActivity extends SecondaryActivity
{
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		setContentView(R.layout.eventspecific);

		String eventName = "Unknown Event";
		String eventDescription = "";
		String eventStartTime = "";
		String eventEndTime = "";

		Bundle extras = getIntent().getExtras();
		if (extras != null)
		{
			eventName = extras.getString("eventName");
			eventDescription = extras.getString("eventDescription");

			long start = extras.getLong("eventStartTime");
			if (start != 0)
				eventStartTime = DBInt.DateFormat.format(start);

			long end = extras.getLong("eventEndTime");
			if (end != 0)
				eventEndTime = DBInt.DateFormat.format(end);
		}

		Button setReminderButton = (Button) findViewById(R.id.eventspecificsetreminder);
		Button homeButton = (Button) findViewById(R.id.eventspecifichome);
		Button backButton = (Button) findViewById(R.id.eventspecificback);

		TextView eventNameTextView = (TextView) findViewById(R.id.eventspecificheader);
		TextView eventDescriptionTextView = (TextView) findViewById(R.id.eventspecificdescription);
		TextView eventStartTimeTextView = (TextView) findViewById(R.id.eventStartTime);
		TextView eventEndTimeTextView = (TextView) findViewById(R.id.eventEndTime);

		eventNameTextView.setText(eventName);
		eventDescriptionTextView.setText(eventDescription);
		eventStartTimeTextView.setText("\nSTART: " + eventStartTime);
		eventEndTimeTextView.setText("\nEND: " + eventEndTime + "\n");

		homeButton.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				Intent i = new Intent(self, EchoActivity.class);
				self.startActivity(i);
				self.finish();
			}
		});

		backButton.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				Intent i = new Intent(self, EventsActivity.class);
				self.startActivity(i);
				self.finish();
			}
		});

		setReminderButton.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				// setNotification();
			}
		});
	}

}
